/*******************************************************************************
 * Copyright (c) 2012 March and Conquest.
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package mrusanov.towers.stats;

import java.io.Serializable;
import java.text.DateFormat;
import java.util.Date;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlType
public class GameStatistics implements Serializable, Comparable<GameStatistics> {

	private static final long serialVersionUID = -1834718083719825096L;

	private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance();

	private String winner;
	private String loser;
	private Date date;
	private int winnersTowerHeight;
	private int losersTowerHeight;
	private int winnersWallHeight;
	private int losersWallHeight;
	private int turns;

	@Override
	public int compareTo(GameStatistics o) {
		return date.compareTo(o.getDate());
	}

	@XmlElement
	public String getWinner() {
		return winner;
	}

	public void setWinner(String winner) {
		this.winner = winner;
	}

	@XmlElement
	public String getLoser() {
		return loser;
	}

	public void setLoser(String loser) {
		this.loser = loser;
	}

	@XmlElement
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@XmlElement
	public int getWinnersTowerHeight() {
		return winnersTowerHeight;
	}

	public void setWinnersTowerHeight(int winnersTowerHeight) {
		this.winnersTowerHeight = winnersTowerHeight;
	}

	@XmlElement
	public int getLosersTowerHeight() {
		return losersTowerHeight;
	}

	public void setLosersTowerHeight(int losersTowerHeight) {
		this.losersTowerHeight = losersTowerHeight;
	}

	@XmlElement
	public int getWinnersWallHeight() {
		return winnersWallHeight;
	}

	public void setWinnersWallHeight(int winnersWallHeight) {
		this.winnersWallHeight = winnersWallHeight;
	}

	@XmlElement
	public int getLosersWallHeight() {
		return losersWallHeight;
	}

	public void setLosersWallHeight(int losersWallHeight) {
		this.losersWallHeight = losersWallHeight;
	}

	@XmlElement
	public int getTurns() {
		return turns;
	}

	public void setTurns(int turns) {
		this.turns = turns;
	}

	@Override
	public String toString() {
		return DATE_FORMAT.format(date);
	}
}
